package com.gomore.opple.data;

import com.gomore.opple.data.remote.bean.WrapperResponseEntity;
import com.gomore.opple.data.remote.bean.result.WeChatResult;
import com.gomore.opple.model.ActionResult;
import com.gomore.opple.model.ShippingAddressEntity;
import com.gomore.opple.model.StoreAddress;
import com.gomore.opple.rest.applybill.ApplyRequest;
import com.gomore.opple.rest.applybill.EarningsResponse;
import com.gomore.opple.rest.applybill.RsApplyBillRequest;
import com.gomore.opple.rest.applybill.RsApplyBillResponse;
import com.gomore.opple.rest.applybill.RsCommissionRequest;
import com.gomore.opple.rest.applybill.RsCommissionResponse;
import com.gomore.opple.rest.applybill.TOBankBindEntity;
import com.gomore.opple.rest.applybill.TOCommAuthEntity;
import com.gomore.opple.rest.consumer.ConsumerDesignerPageResult;
import com.gomore.opple.rest.consumer.ConsumerPageResult;
import com.gomore.opple.rest.consumer.ConsumerQueryCondition;
import com.gomore.opple.rest.employee.LoginInfo;
import com.gomore.opple.rest.employee.LoginResult;
import com.gomore.opple.rest.employee.ModifyPasswordRequest;
import com.gomore.opple.rest.employee.ResetPasswordRequest;
import com.gomore.opple.rest.employee.RsEmployeeRequest;
import com.gomore.opple.rest.goods.GoodsCondition;
import com.gomore.opple.rest.goods.GoodsFilter;
import com.gomore.opple.rest.goods.GoodsResponse;
import com.gomore.opple.rest.hottag.HotFilter;
import com.gomore.opple.rest.jdecard.RsJingDongECardRequest;
import com.gomore.opple.rest.jdecard.RsJingDongECardResponse;
import com.gomore.opple.rest.lottery.Draw;
import com.gomore.opple.rest.lottery.RsLotteryRequest;
import com.gomore.opple.rest.lottery.RsLotteryResponse;
import com.gomore.opple.rest.order.OrderBill;
import com.gomore.opple.rest.order.OrderFilter;
import com.gomore.opple.rest.order.OrderPayRequest;
import com.gomore.opple.rest.order.OrderResponse;
import com.gomore.opple.rest.order.RsOrderShareResponse;
import com.gomore.opple.rest.redPackage.RedPackageResponse;
import com.gomore.opple.rest.redPackage.RsRedPackageConditions;
import com.gomore.opple.rest.shopcart.DeleteCartRequest;
import com.gomore.opple.rest.shopcart.SaveShoppingCartRequest;
import com.gomore.opple.rest.shopcart.ShopCartFilter;
import com.gomore.opple.rest.shopcart.ShopCartResponse;
import com.gomore.opple.web.cgform.app.entity.TOAppversionEntity;
import com.gomore.opple.web.cgform.applybill.entity.TOApplyBillEntity;
import com.gomore.opple.web.cgform.consumer.entity.TOConsumerEntity;
import com.gomore.opple.web.cgform.goods.entity.TOGoodsEntity;
import com.gomore.opple.web.cgform.orderpromotion.entity.TOOrderPromotionEntity;
import com.gomore.opple.web.cgform.resellerstore.entity.TOResellerstoreEntity;
import com.gomore.opple.web.cgform.resellerstore.entity.ToStoreAddress;
import com.gomore.opple.web.cgform.shippingaddr.entity.TOShippingAddrEntity;
import com.gomore.opple.web.system.pojo.TOReseller;

import java.util.List;

import okhttp3.MultipartBody;
import retrofit2.Call;
import rx.Observable;

/**
 * Created by Kennen on 2016/12/23.
 */
public interface DataSource {

    /**
     * 保存用户名
     */
    void saveUserName(String userName);

    /**
     * 获取用户名
     */
    String getUserName();

    /**
     * 保存密码
     */
    void savePassWord(String passWord);

    /**
     * 获取密码
     */
    String getPassWord();

    /**
     * 保存用户信息
     *
     * @param user
     */
    void saveUser(LoginResult user);

    /**
     * 获取用户信息
     */
    LoginResult getUser();

    /**
     * 保存客户信息
     *
     * @param toConsumerEntity
     */
    void saveConsumer(TOConsumerEntity toConsumerEntity);

    /**
     * 获取客户信息
     */
    TOConsumerEntity getConsumer();

    /**
     * 清除客户
     */
    void clearConsumer();

    /**
     * 保存当前版本号
     *
     * @param version
     */
    void saveAppVersion(String version);

    /**
     * 获取版本号
     */
    String getAppVersion();

    /**
     * 退出时候清除数据
     */
    void clearMessage();

    /**
     * 获取搜索关键字
     *
     * @return
     */
    List<String> getSearchKey();

    /**
     * 保存搜索关键字
     *
     * @param keys
     */
    void saveSearchKey(List<String> keys);

    /**
     * 清空历史记录
     */
    void clearHistory();

    /**
     * 升级接口
     *
     * @param apptype
     * @param version
     * @return
     */
    Observable<WrapperResponseEntity<TOAppversionEntity>> checkUpdate(String apptype, String version);

    /**
     * 登录请求
     *
     * @param loginInfo
     * @return
     */
    Observable<WrapperResponseEntity<LoginResult>> login(LoginInfo loginInfo);

    /**
     * 重置密码
     *
     * @param resetPasswordRequest
     * @return
     */
    Observable<WrapperResponseEntity<String>> restPassword(ResetPasswordRequest resetPasswordRequest);

    /**
     * 发送验证码
     *
     * @param mobilephone
     * @param username
     * @return
     */
    Observable<WrapperResponseEntity<String>> sendCode(String mobilephone, String username);

    /**
     * 同步登录请求
     *
     * @param loginInfo
     * @return
     */
    Call<WrapperResponseEntity<LoginResult>> loginSyn(LoginInfo loginInfo);

    /**
     * 获取客户
     *
     * @param consumerQueryCondition
     * @return
     */
    Observable<WrapperResponseEntity<ConsumerDesignerPageResult>> getConsumer(ConsumerQueryCondition consumerQueryCondition);

    /**
     * 保存客户访问时间
     *
     * @param consumerId
     * @return
     */

    Observable<WrapperResponseEntity<String>> saveLastVisitedTime(String consumerId);

    /**
     * 保存客户
     *
     * @param toConsumerEntity
     * @return
     */
    Observable<WrapperResponseEntity<String>> save(TOConsumerEntity toConsumerEntity);

    /**
     * 查询商品
     *
     * @param goodsCondition
     * @return
     */
    Observable<WrapperResponseEntity<GoodsResponse>> queryGoods(GoodsCondition goodsCondition);

    /**
     * 获取所有筛选条件
     *
     * @return
     */
    Observable<WrapperResponseEntity<GoodsFilter>> getGoodsFilter();

    /**
     * 获取单个商品
     *
     * @return
     */
    Observable<WrapperResponseEntity<TOGoodsEntity>> getGoodById(String goodId);

    /**
     * 添加到购物车
     *
     * @param saveShoppingCartRequest
     * @return
     */
    Observable<WrapperResponseEntity<String>> addToShoppingCar(SaveShoppingCartRequest saveShoppingCartRequest);

    /**
     * 获取热门推荐
     *
     * @return
     */
    Observable<WrapperResponseEntity<HotFilter>> getHotTag();

    /**
     * 查询购物车
     *
     * @param shopCartFilter
     * @return
     */
    Observable<WrapperResponseEntity<ShopCartResponse>> queryShoppingCar(ShopCartFilter shopCartFilter);

    /**
     * 更改成交价
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> updateCostPrice(String cartId, String costPrice,
                                                              String goodsId, String goodsNum);

    /**
     * 删除购物车
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> deleteShoppingCar(DeleteCartRequest deleteCartRequest);

    /**
     * 查询收货地址
     *
     * @return
     */
    Observable<WrapperResponseEntity<ShippingAddressEntity>> getShippingAddress(String consumerUuid);

    /**
     * 保存收货地址
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> saveShippingAddress(TOShippingAddrEntity toShippingAddrEntity);

    /**
     * 更新收货地址
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> updateShippingAddress(TOShippingAddrEntity toShippingAddrEntity);

    /**
     * 删除收货地址
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> removeShippingAddress(String shippingUuid);

    /**
     * 保存订单
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> saveOrder(OrderBill orderBill);

    /**
     * 获取订单
     *
     * @return
     */
    Observable<WrapperResponseEntity<OrderBill>> getOrderByNumber(String order_number);

    /**
     * 上传附件
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> uploadAttachment(MultipartBody.Part file);

    /**
     * 获取促销结果
     *
     * @return
     */
    Observable<WrapperResponseEntity<ActionResult>> getCalc(String orderNumber);

    /**
     * 获取经营者二维码
     *
     * @return
     */
    Observable<WrapperResponseEntity<TOReseller>> getReseller();

    /**
     * 支付订单
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> payOrder(OrderPayRequest orderPayRequest);

    /**
     * 分享订单
     *
     * @return
     */
    Observable<WrapperResponseEntity<RsOrderShareResponse>> orderShare(String order_number);

    /**
     * 修改订单状态
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> updateOrderState(String order_number,
                                                               String oldstate,
                                                               String newstate);

    /**
     * 获取我的信息
     *
     * @return
     */
    Observable<WrapperResponseEntity<EarningsResponse>> getTotal(String employeeId);

    /**
     * 验证银行卡
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> commAuth(TOCommAuthEntity toCommAuthEntity);

    /**
     * 绑定银行卡
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> bind(TOBankBindEntity toBankBindEntity);

    /**
     * 绑定银行卡，发送验证码
     *
     * @param mobilephone
     * @param username
     * @return
     */
    Observable<WrapperResponseEntity<String>> bankCardBindSendSms(String mobilephone, String username);

    /**
     * 解绑银行卡
     *
     * @param bankAccount
     * @return
     */
    Observable<WrapperResponseEntity<String>> unbind(String bankAccount);

    /**
     * 提现申请保存
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> applySave(ApplyRequest applyRequest);

    /**
     * 查询收支明细
     *
     * @return
     */
    Observable<WrapperResponseEntity<RsCommissionResponse>> queryIncomeAndExpense(RsCommissionRequest rsCommissionRequest);

    /**
     * 查询提现进度明细
     *
     * @return
     */
    Observable<WrapperResponseEntity<RsApplyBillResponse>> queryApply(RsApplyBillRequest rsApplyBillRequest);

    /**
     * 查询京东E卡
     *
     * @return
     */
    Observable<WrapperResponseEntity<RsJingDongECardResponse>> queryJDE(RsJingDongECardRequest rsJingDongECardRequest);

    /**
     * 激活京东E卡
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> activeJDE(String orderNumber, String orderReceiptUrl);

    /**
     * 使用京东E卡
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> useJDE(String cardNumber);

    /**
     * 查询我的抽奖
     *
     * @return
     */
    Observable<WrapperResponseEntity<RsLotteryResponse>> queryAward(RsLotteryRequest rsLotteryRequest);

    /**
     * 去抽奖
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> drawAward(Draw draw);

    /**
     * 查询红包
     *
     * @return
     */
    Observable<WrapperResponseEntity<RedPackageResponse>> queryRedPackage(RsRedPackageConditions rsRedPackageConditions);

    /**
     * 激活红包
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> activeRedPackage(String orderNumber, String orderReceiptUrl);

    /**
     * 查询订单
     *
     * @return
     */
    Observable<WrapperResponseEntity<OrderResponse>> queryOrder(OrderFilter orderFilter);

    /**
     * 退出登录
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> logout();

    /**
     * 修改密码
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> modifyPassword(ModifyPasswordRequest modifyPasswordRequest);

    /**
     * 保存门店代码
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> saveResellerStore(TOResellerstoreEntity toResellerstoreEntity);

    /**
     * 保存门店地址
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> saveStoreAddress(ToStoreAddress toStoreAddress);

    /**
     * 获取购物车的数量
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> getShoppingCarNumber(String consumerId);

    /**
     * 使用微信卡卷
     *
     * @param voucherNo
     * @param orderNum
     * @param orderTotal
     * @return
     */
    Observable<WeChatResult> getWeChat(String voucherNo, String orderNum, String orderTotal);

    /**
     * 通过条形码获取商品
     *
     * @return
     */
    Observable<WrapperResponseEntity<TOGoodsEntity>> getGoodsByCode(String barcode);

    /**
     * 修改员工资料
     *
     * @return
     */
    Observable<WrapperResponseEntity<String>> updateEmployee(RsEmployeeRequest rsEmployeeRequest);

    /**
     * 获取提现进度明细
     *
     * @return
     */
    Observable<WrapperResponseEntity<TOApplyBillEntity>> getDetailState(String uuid);

    /**
     * 促销记录
     *
     * @return
     */
    Observable<WrapperResponseEntity<List<TOOrderPromotionEntity>>> getOrderPromotion(String orderNumber);

    /**
     * 获取门店地址
     *
     * @return
     */
    Observable<WrapperResponseEntity<StoreAddress>> getStoreAddress(String currentDepartId);
}

